package time3;

import javax.swing.*;
import java.awt.event.ActionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.Date;
public class Main {
    public static void main(String[] args)
    {
        ActionListener listener = new TimePrinter();
        Timer t = new Timer(10000,listener);
        t.start();
        JOptionPane.showMessageDialog(null,"请稍等或按确定介绍");
        System.exit(0);
    }
}

class TimePrinter implements ActionListener{

    public void actionPerformed(ActionEvent e) {
        Date now=new Date();
        System.out.println("At the tone,the time is "+now);
        Toolkit.getDefaultToolkit().beep();
    }
}